<template>
	<view class="layout">
		<view class="navbar">
			<view class="statusBar" :style="{ height: getStatusBarHeight() + 'px' }"></view>
			<view class="titleBar" :style="{
          height: getTitleBarHeight() + 'px',
          marginLeft: getLeftIconLeft() + 'px',
        }">
				<view class="text">{{ title }}</view>
				<view class="search" @click="goSearch">
					<uni-icons type="search" size="26" color="#999"></uni-icons>
					<text>搜索</text>
				</view>
			</view>
		</view>
		<view class="fill" :style="{ height: getNavBarHeight() + 'px' }"></view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import {
		getStatusBarHeight,
		getTitleBarHeight,
		getNavBarHeight,
		getLeftIconLeft,
	} from "@/utils/system.js";

	defineProps({
		title: {
			type: String,
			default: "壁纸",
		},
	});
	const goSearch = () => {
		uni.navigateTo({
			url: "/pages/search/search",
		});
	};
</script>

<style lang="scss" scoped>
	.layout {
		.navbar {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 10;
			background: linear-gradient(to bottom, transparent, white 400rpx),
				linear-gradient(to right, #beecd8 20%, #f4e2d8);

			.statusBar {}

			.titleBar {
				display: flex;
				align-items: center;
				padding: 0 30rpx;

				.text {
					font-weight: 700;
					font-size: 24px;
					color: $text-font-color-1;
				}

				.search {
					display: flex;
					align-content: center;
					margin-left: 20rpx;
					background: #fff;
					border: 1px solid #eee;
					width: 200rpx;
					height: 50rpx;
					border-radius: 60rpx;

					text {
						padding-left: 10rpx;
						color: #999;
						line-height: 50rpx;
					}
				}
			}
		}

		.fill {}
	}
</style>